//
//  KDPatientJudgeViewController.m
//  LaiKeDaoClient
//
//  Created by dongkedi的iMac on 15/11/24.
//  Copyright © 2015年 LKD. All rights reserved.
//

#import "KDPatientJudgeViewController.h"

@interface KDPatientJudgeViewController ()<UIWebViewDelegate>{
    UIWebView                   *_webView;
}


@end

@implementation KDPatientJudgeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view setBackgroundColor:[UIColor whiteColor]];
    [self setNaviLeftButton];
    [self setNaviTitle:@"患者评价"];

    _webView = [[UIWebView alloc] initWithFrame:(CGRect){0,0,self.view.bounds.size.width,self.view.bounds.size.height-64}];
    _webView.scalesPageToFit =YES;
    _webView.delegate =self;
    _webView.backgroundColor = [UIColor clearColor];
    [self.view addSubview:_webView];
}
- (void)viewWillAppear:(BOOL)animated
{
    SharedAppDelegate.tabBarController.tabBarIsHiden = YES;
    if (self.urlStr.length > 0) {
        [self loadWebPageWithString:self.urlStr];
    }else{
        [self loadWebPageWithString:@"http://www.baidu.com"];
    }
}

- (void)viewWillDisappear:(BOOL)animated
{
    SharedAppDelegate.tabBarController.tabBarIsHiden = NO;
}

#pragma mark - UIWebViewDelegate
- (void)loadWebPageWithString:(NSString*)urlString
{
    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlString]        cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:5];
    [request setHTTPMethod:@"GET"];
    
    [_webView loadRequest:request];
}

- (void)webViewDidStartLoad:(UIWebView *)webView//开始加载的时候执行该方法。
{
}

- (void)webViewDidFinishLoad:(UIWebView *)webView//加载完成的时候执行该方法。
{
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error//加载出错的时候执行该方法。
{
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
